<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>局部注册组件</title>
</head>

<body>
    <div id="app">
        <my-header></my-header>
    </div>
</body>
<template id="header">
    <header>
        标题 - {{ msg }}
        <button @click="add">{{ count }}</button>
    </header>
</template>
<script src="lib/vue.js"></script>
<script>
    new Vue({
        el: "#app",
        data: {

        },
        components: {
            // 组件可以有多个
            MyHeader: {
                template: "#header",
                data() {
                    return {
                        msg: "huguo",
                        count: 9999
                    }
                },
                methods: {
                    add() {
                        this.count++
                    }
                }
            }
        }
    })
</script>

</html>